﻿@{
    ViewBag.Title = "UpdateInfoList";
}

@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
@Html.Partial("~/Views/Modular/Tool.cshtml")
<form id="form1">
    <div id = "DivHeader">
        <table style="margin-bottom:4px;">
            <tr>
                <td width ="70px" align="right">单据日期：</td>
                <td width ="310px">
                    @Html.Partial("~/Views/Modular/dxDateRange.cshtml") 
                </td>
                <td width ="70px" align="right">选择会员：</td>
                <td width ="195px">
                    @Html.Partial("~/Views/Modular/LookupMember.cshtml")                      
                </td>
            </tr>
        </table>
    </div>
</form>
<div class="mini-fit">
    <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" pageSize="15" fitColumns="false"
            borderStyle="border:1;" url="GetWxMessageList" sortMode="client" onrowdblclick="showInfo">
        <div property="columns">
            <div type="checkcolumn" >选行</div>
            <div type="indexcolumn" width="40" headerAlign="center" >序号</div>
            <div field="FDateTime" name="FDateTime" width="150" headeralign="center" dateformat="yyyy-MM-dd HH:mm:ss">日期</div>
            <div field="FPhone" name="FPhone" width="120" headeralign="center" allowsort="true">会员号</div>
            <div field="FTemplateName" name="FTemplateName" width="160" headeralign="center" allowsort="true">消息标题</div>
            <div field="FTemplateNumber" name="FTemplateNumber" width="160" headeralign="center" allowsort="true">消息模板</div>
            <div field="FSendFlag" type="checkboxcolumn" name="FSendFlag" trueValue="1" falseValue="0" width="60" headeralign="center" allowsort="true">是否成功</div>
        </div>
    </div>
</div>

<script>
    mini.parse();
    function FormShown() {
        var toDay = new Date();
        mini.getbyName("FDate1").setValue(toDay);
        mini.getbyName("FDate2").setValue(toDay);
        LoadListData();
    }

    function setkeyPress() {
        LoadListData();
    }

    //加载资料列表
    function LoadListData() {
        var form = new mini.Form("#form1");
        var data = form.getData(true, false);
        var formjson = mini.encode(data);
        var sSystemAppID = parent.window.getSystemAppID();
        var json = "[{";
        json = json + "'FSystemAppID':" + "'" + sSystemAppID + "',";
        json = json + "'search':'" + formjson + "'}]";
        var grid = mini.get("datagrid1");
        grid.load({ mydata: json });
    }

    //搜索资料列表
    function search() {
        LoadListData();
    }

    //刷新
    function refresh() {
        LoadListData();
    }

    function showInfo() {
        var grid = mini.get("datagrid1");
        var row = grid.getSelected();
        if (row) {
            mini.open({
                url: "/UpdateInfo/WxMessageInfo",
                title: "消息日志", width: 700, height: 550,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var data = { action: "edit", FEntryID: row.FEntryID };
                    iframe.contentWindow.SetInfoData(data);
                },
                ondestroy: function (action) {
                }
            });
        }
    }
</script>
